Is there a STL function that returns an iterator or index to the smallest element greater than some input value in an unsorted array. std::lower_bound
doesn't work because it requires partitioning, and my array is not partitioned according to its requirements.
For example,
int main(int argc, char const *argv[])
{
vector<int> vec{5,1,2,9,1,5,3};
std::cout << std::lower_bound(vec.begin(), vec.end(), 2) - vec.begin() << std::endl;
}
The output here is 3 when I want it to be 6 corresponding to vec[6].